import requests

from common.token_util import TokenUtil


class DepartUtil:

    # 获取部门id的方法
    @classmethod
    def get_depart_id(cls):
        url = " http://ihrm2-test.itheima.net/api/company/department/"
        header = {"Content - Type": "application/json", "Authorization": TokenUtil.get_token()}
        body = {"name": "test_depart_001", "code": "12345"}
        resp = requests.post(url=url, headers=header, json=body)
        depart_id = resp.json().get("data").get("id")
        return depart_id
